using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Universum.Infrastructure.Configuration;
using Universum.Model.Services.Indexing;

namespace Universum.Controllers
{
	[Authorize(Users = ConstantIdentifiers.SPECIAL_USER)]
    public class ReIndexingController : UniversumController
    {
		ITeacherArticleIndexingService _ArticleIndexing;
			IQuestionIndexingService _QuestionIndexing;
			IBlogArticleIndexingService _BlogIndexing;
		public ReIndexingController (
			System.Security.Principal.IPrincipal principal,
			ITeacherArticleIndexingService articleIndexing,
			IQuestionIndexingService questionIndexing,
			IBlogArticleIndexingService blogIndexing
			)
			:base(principal)
			{
				_ArticleIndexing = articleIndexing;
				_BlogIndexing = blogIndexing;
				_QuestionIndexing = questionIndexing;
			}
        //
        // GET: /ReIndexing/
		public ActionResult Index()
		{
			return View();
		}
		
		public ActionResult Questions()
		{
			
			_QuestionIndexing.ReBuildAll();
			return View("Index");
		}
		public ActionResult PageArticles()
		{
			_ArticleIndexing.ReBuildAll();
			
			return View("Index");
		}
		public ActionResult Blogs()
		{

			_BlogIndexing.ReBuildAll();
			
			return View("Index");
		}

    }
}
